layui.define(["jquery"], function(exports) {
  var $ = layui.jquery;
  var obj = {
    assignWithPrefix: function(data, prefix, areaSelector) {
      for (var key in data) {
        keyStr = key.toString();
        keyVal = data[key];
        // console.log("key = %s, val = %s", keyStr, keyVal);
        if (areaSelector == null) eleObj = $("#" + prefix + keyStr);
        else eleObj = $("#" + areaSelector).find("#" + prefix + keyStr);
        if (eleObj.length > 0) {
          // console.log("id = %s 元素存在，赋值 val = %s", keyStr, keyVal);
          eleObj.html(keyVal);
          eleObj.val(keyVal);
        }
      }
    },
    assign: function(data) {
      obj.assignWithPrefix(data, "");
    }
  };
  exports("assignHelper", obj);
});
